package com.example.administrator.test.personal;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.example.administrator.test.R;
import com.example.administrator.test.fragment.FragmentMyFansDriver;
import com.example.administrator.test.fragment.FragmentMyFansPassenger;
import com.example.administrator.test.fragment.FragmentMyOrderCancel;
import com.example.administrator.test.fragment.FragmentMyOrderOnGoing;
import com.example.administrator.test.fragment.FragmentMyorderCompleted;

/**
 * Created by Administrator on 2016/12/1.
 */
public class MyOrderActivity extends AppCompatActivity {
    private FragmentManager manager;
    private FragmentTransaction transaction;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_myorder);
        manager=getSupportFragmentManager();
        transaction=manager.beginTransaction();
        transaction.add(R.id.layout_fragment_myorder,new FragmentMyOrderOnGoing());
        transaction.commit();
    }
    public void clickMyOrder(View view){
        switch (view.getId()){
            case R.id.rb_myorder_ongoing:
                manager=getSupportFragmentManager();
                transaction=manager.beginTransaction();
                transaction.replace(R.id.layout_fragment_myorder,new FragmentMyOrderOnGoing());
                transaction.commit();
                break;
            case R.id.rb_myorder_completed:
                manager=getSupportFragmentManager();
                transaction=manager.beginTransaction();
                transaction.replace(R.id.layout_fragment_myorder,new FragmentMyorderCompleted());
                transaction.commit();
                break;
            case R.id.rb_myfans_cancel:
                manager=getSupportFragmentManager();
                transaction=manager.beginTransaction();
                transaction.replace(R.id.layout_fragment_myorder,new FragmentMyOrderCancel());
                transaction.commit();
                break;
        }
    }
    public void clickMyOrderBack(View view){
        onBackPressed();
    }
}
